package com.taotao.merchant.controller;

import com.taotao.common.core.domain.Result;
import com.taotao.merchant.service.TokenService;
import com.taotao.merchant.util.IdGeneratorUtil;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @className: TokenController
 * @author: ZhangYuQi
 * @date: 2025/1/20 下午2:23
 * @Version: 1.0
 * @description:
 */

@RestController
@RequestMapping("token")
public class TokenController {

    @Autowired
    private TokenService tokenService;

    /**
    * @Author ZhangYuQi
    * @Description 生成token
    * @Date 下午3:27 2025/1/20
    * @Param []
    * @return
    */
    @RequestMapping("/getIdGeneratorToken")
    public String getIdGeneratorToken() {
        String generateId = IdGeneratorUtil.generateId();
        tokenService.save(generateId);
        return generateId;
    }
}
